<%@ page language="Java" import="java.util.*,descriptor.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%
	QueryListDescriptor queryList = (QueryListDescriptor)request.getAttribute("listQueries");
	StudentListDescriptor studentList = (StudentListDescriptor)request.getAttribute("listStudent");
	AcademicSupDescriptor academicSup = (AcademicSupDescriptor)request.getAttribute("academicSup");
	if(academicSup == null){
		response.sendRedirect("index.jsp");
	}

%>
<html>
	<jsp:include page="academicSupervisorHeader.jsp" >
		<jsp:param name="pageTitle" value="Work Placement Management System - Academic Supervisor" />
	</jsp:include>
	<body OnLoad="showmenu(document.getElementById('smenu2'));">
		<jsp:include page="academicSupervisorPageHeader.jsp"></jsp:include>
		<div id="container">
			<jsp:include page="academicSupMenu.jsp" ></jsp:include>
			<div id="content">
			<h3 class="posttitle">You have <%=queryList.getQueryList().size()%> Queries:</h3>
				<div class="entry">
		<br/>
			<table cellpadding="0" cellspacing="10" border="0">
				<%
				for(QueryDescriptor query : queryList.getQueryList()){
				%>
				<tr>
					<td><%=(studentList.getStudent(query.getStudentID())).getFirstName()%> <%=(studentList.getStudent(query.getStudentID())).getSurName()%></td><td><%= query.getMessage()%></td>
					<%if(query.getStatus() == 0){%>
					<td><a href="AcademicSupServlet?page=academicSupervisorQueryAccepted&amp;queryId=<%=query.getID()%>">Accept</a>/
					    <a href="AcademicSupServlet?page=academicSupervisorQueryRejected&amp;queryId=<%=query.getID()%>">Reject</a></td>
					    <%
					    }if(query.getStatus() == 1){
					    %>
					    <td>Query accepted</td>
					    <%
					    }if(query.getStatus() == -1){
					    %>
					    <td>Query Rejected</td>
					    <%
					    }
					    %>
				</tr>
				<%
				}
				%>
			</table>
				</div>
	    	</div>
			<jsp:include page="academicSupervisorPageFooter.jsp"></jsp:include>
		</div>
	</body>
</html>
